import { VxeGridPropTypes } from "vxe-table/types/grid";

export const columns: VxeGridPropTypes.Columns = [
  {type: 'checkbox', width: 40, fixed: 'left',},
  {type: 'seq', title: '序号', treeNode: true, width: 60,},
  {field: 'ID', title: 'ID', width: 60, visible: false,},
  {field: 'group', title: '按钮组', visible: false, sortable: false,},
  {field: 'name', title: '按钮名称', visible: true, sortable: false, width: 110,},
  {field: 'icon', title: '图标', visible: true, sortable: false, width: 70, 
  // cellRender: {events: ({row}) => {
  //   return <Icon icon={row.meta.icon}/>
  // }},
  },
  {field: 'place', title: '按钮位置', visible: true, sortable: false, width: 100,
  formatter: ({cellValue,}) => {
    let result = '未知'
    switch(cellValue) {
      case 0: result = '表格上方-左边'; break;
      case 1: result = '表格上方-右边'; break;
      case 2: result = '表格内-操作'; break;
      case 3: result = '其他'; break;
    }
    return result;
  },
  },
  {field: 'func', title: '方法', visible: true, sortable: false, width: 110,},
  {field: 'sort', title: '顺序', visible: true, sortable: false, width: 50,},
  {field: 'disable', title: '默认交互', visible: true, sortable: false, width: 120, 
  titlePrefix: {content: '0=可交互 1=不可交互-没数量 2=不可交互-有数量'},
  formatter: ({cellValue,}) => {
    let result = '未知'
    switch(cellValue) {
      case 0: result = '可交互';break;
      case 1: result = '不可交互-没数量';break;
      case 2: result = '不可交互-有数量';break;
    }
    return result;
  },},
  {field: 'enable', title: '启用', visible: true, sortable: false, width: 60, formatter: 'formatEnable',},
  {field: 'tip', title: '是否提示', visible: true, sortable: false, width: 70,},
  {field: 'tipContent', title: '提示内容', visible: true, sortable: false, width: 150,},
  {field: 'otherConf', title: '其他配置', visible: true, sortable: false, width: 140,},
  {field: 'memo', title: '备注', visible: false, sortable: false, width: 120,},
  {field: 'creatorId', title: '创建人', visible: false, sortable: false,},
  {field: 'createdTime', title: '创建时间', visible: false, sortable: false,},
  {field: 'updatedTime', title: '更新时间', visible: false, sortable: false,},
];

export const columnsOfArea: VxeGridPropTypes.Columns = [
  // {type: 'checkbox', width: 40, fixed: 'left',},
  {type: 'seq', title: '序号', treeNode: true, width: 60,},
  {field: 'ID', title: 'ID', width: 60, visible: false,},
  {field: 'name', title: '库区', visible: true, sortable: false, width: 'auto',},
  {field: 'code', title: '库区编号', visible: true, sortable: false,},
  // {field: 'place', title: '按钮位置', visible: true, sortable: false, width: 100,
  // formatter: ({cellValue,}) => {
  //   let result = '未知'
  //   switch(cellValue) {
  //     case 0: result = '表格上方-左边'; break;
  //     case 1: result = '表格上方-右边'; break;
  //     case 2: result = '表格内-操作'; break;
  //     case 3: result = '其他'; break;
  //   }
  //   return result;
  // },
  // },
  {field: 'enable', title: '启用', visible: true, sortable: false, width: 60, formatter: 'formatEnable',},
  {field: 'memo', title: '备注', visible: true, sortable: false, width: 'auto',},
  
  {field: 'uid', title: '创建人', visible: false, sortable: false,},

  {field: 'createdAt', title: '创建时间', visible: false, sortable: false,},
  {field: 'updatedAt', title: '更新时间', visible: false, sortable: false,},
];

//
export interface NameValue {
  label: string,
  value: string,
}

export const nameOptions = [
  {value: 'seeDetails', label: '详情',},
  {value: 'create', label: '新增',},
  {value: 'edit', label: '编辑',},
  {value: 'batchDelete', label: '删除',},
  {value: 'copy', label: '复制行',},
  {value: 'grant', label: '授权',},
  {value: 'verify', label: '审核',},
  {value: 'unVerify', label: '弃审',},
  {value: 'close', label: '关闭',},
  {value: 'toVoid', label: '作废',},
  {value: 'invtIn', label: '入库',},
  {value: 'invtBatchIn', label: '批量入库',},
  {value: 'invtOut', label: '出库',},
  {value: 'invtBatchOut', label: '批量出库',},
];

export const placeOptions = [
  {value: 0, label: '表格上方-左边',},
  {value: 1, label: '表格上方-右边',},
  {value: 2, label: '表格内-操作',},
  {value: 3, label: '其他',},
];

export const disabledOptions = [
  {value: 0, label: '可交互',},
  {value: 1, label: '不可交互-没数量',},
  {value: 2, label: '不可交互-有数量',},
];